package com.menker.app.biz;


import android.graphics.Color;
import android.text.TextUtils;

import com.menker.app.common.Utils;

public class PageInfo {

    public boolean toolbarVisible;
    public boolean toolbarUpButtonEnabled;
    public String toolbarTitle;
    public int toolbarTitleColor;
    public int toolbarBgColor;

    public PageInfo() {
        this(false);
    }

    /**
     * 没有Toolbar
     */
    public PageInfo(boolean toolbarVisible) {
        this("", toolbarVisible, 0, 0);
    }

    public PageInfo(String title) {
        this(title, true, 0, 0);
    }

    public PageInfo(String title, int toolbarTitleColor, int toolbarBgColor) {
        this(title, true, toolbarTitleColor, toolbarBgColor);
    }

    public PageInfo(String title, String toolbarTitleHexColor, String toolbarBgHexColor) {
        this.toolbarVisible = true;
        this.toolbarTitle = title;

        if (TextUtils.isEmpty(Utils.Color.getColorString(toolbarTitleHexColor))) {
            this.toolbarTitleColor = 0;
        } else {
            this.toolbarTitleColor = Color.parseColor(Utils.Color.getColorString(toolbarTitleHexColor));
        }
        if (TextUtils.isEmpty(Utils.Color.getColorString(toolbarBgHexColor))) {
            this.toolbarBgColor = 0;
        } else {
            this.toolbarBgColor = Color.parseColor(Utils.Color.getColorString(toolbarBgHexColor));
        }
    }

    public PageInfo(String title,
                    boolean toolbarVisible,
                    String toolbarTitleHexColor, String toolbarBgHexColor) {
        this.toolbarVisible = toolbarVisible;

        this.toolbarTitle = title;

        if (TextUtils.isEmpty(Utils.Color.getColorString(toolbarTitleHexColor))) {
            this.toolbarTitleColor = 0;
        } else {
            this.toolbarTitleColor = Color.parseColor(Utils.Color.getColorString(toolbarTitleHexColor));
        }
        if (TextUtils.isEmpty(Utils.Color.getColorString(toolbarBgHexColor))) {
            this.toolbarBgColor = 0;
        } else {
            this.toolbarBgColor = Color.parseColor(Utils.Color.getColorString(toolbarBgHexColor));
        }
    }

    public PageInfo(String title,
                    boolean toolbarVisible,
                    int toolbarTitleColor, int toolbarBgColor) {
        this.toolbarVisible = toolbarVisible;

        this.toolbarTitle = title;

        this.toolbarTitleColor = toolbarTitleColor;
        this.toolbarBgColor = toolbarBgColor;
    }
}
